"""
-*- coding:utf-8 -*-
最终版web自动化
Author: Free
DataTime: 2020/1/10 18:32

"""

from PubilcTask.Common.LoginChangeUser import LoginRegister
from public_tools.configTool import ConfigTool
# import unittest


class TesterLogin(LoginRegister):
    config = ConfigTool()
    config.build_path(r'D:\commercial_opportunity_zhu\config\config.ini')
    user = config.get('testuser', 'ChangeUser0')
    user01 = config.get('testuser', 'ChangeUser1')

    # @unittest.skip("skip")
    def test_login(self):
        """
        登录切换用户
        :return:
        """

        self.input_text()
        self.input_password()
        self.choice_common()
        self.login_pc()
        self.change_user()
        LoginRegister.Change_frame(self)
        self.assertEqual(self.b.find_element_by_id('lblTargetUserName').text, u'目标用户:张震', '切到张震失败')

    def test_login01(self):
        """
        登录切换用户
        :return:
        """
        config = ConfigTool()
        config.build_path(r'D:\commercial_opportunity_zhu\config\config.ini')
        user = config.get('testuser', 'ChangeUser0')
        self.input_text()
        self.input_password()
        self.choice_common()
        self.login_pc()
        self.change_user(user=user)
        LoginRegister.Change_frame(self)
        self.assertEqual(self.b.find_element_by_id('lblTargetUserName').text, u'目标用户:张震', '切到张震失败')

    def test_login02(self):
        """
        登录切换用户
        :return:
        """
        config = ConfigTool()
        config.build_path(r'D:\commercial_opportunity_zhu\config\config.ini')
        user = config.get('testuser', 'ChangeUser1')
        self.input_text()
        self.input_password()
        self.choice_common()
        self.login_pc()
        self.change_user(user=user)
        LoginRegister.Change_frame(self)
        self.assertEqual(self.b.find_element_by_id('lblTargetUserName').text, u'目标用户:张震', '切到张震失败')


